class PeopleController < ApplicationController

  def show_rate
    check_app_user
    if params[:people_id]
      @people = Xiaonei::User.new
      @people.uid = params[:people_id]
    end

    make_xiaonei_redirection ({:controller => :xiaonei, :action => :index })  unless @people    

    @ratings = Rating.paginate(:all, 
                               :conditions => ["rater_id = ?",params[:people_id]],
                               :include => [:couple],
                               :page => params[:page], 
                               :per_page => 20)
   @ratings ||= [] 
  
  end

  def show_rating
    check_app_user
    if params[:people_id]
      @people = Xiaonei::User.new
      @people.uid = params[:people_id]
    end

    make_xiaonei_redirection ({:controller => :xiaonei, :action => :index })  unless @people    

    @couples = Couple.paginate(:all, 
                               :order => "rating_avg DESC",
                               :conditions => ["first_user_id = ? or second_user_id = ?", params[:people_id],  params[:people_id]],
                               :page => params[:page], 
                               :per_page => 20)    
    @couples ||= []     
  end
end


